import React from 'react';
import { connect } from 'dva';
import { routerRedux } from 'dva/router';
import {Icon,WhiteSpace} from 'antd-mobile';
import style from './ranklistPerson.less';


class RankListIteam extends React.Component {

  constructor(props){
    super(props);
    this.state = {

    };
  }

  onclick = () =>{
    const {org,ORGCODE,date,year} =this.props;
    this.props.dispatch(
      routerRedux.push({
        pathname:`/points/rankpersontorank`,
        query: {
          org:org,
          ORGCODE:ORGCODE,
          date:date,
          year:year,
        }
      })
    )};

  render(){

    const {rank,org,point1,point2,point3,point4,point5}=this.props;

    return (
      <div>
        {/*//组织rank*/}
        <div className={style.organize} onClick={this.onclick}>
          {/*<div className={style.left}>*/}
            {/*<div>{rank}</div>*/}
          {/*</div>*/}
          {/*<div className={style.middle}>*/}
            {/*/!*<div className={style.middleTop}>{org}</div>*!/*/}
            {/*/!*<div className={style.middleBottom}>*!/*/}
              {/*/!*<span>完成度<br/>{point1}分</span>*!/*/}
              {/*/!*<span>活跃度<br/>{point2}分</span>*!/*/}
              {/*/!*<span>参与度<br/>{point3}分</span>*!/*/}
              {/*/!*<span>满意度<br/>{point4}分</span>*!/*/}
            {/*/!*</div>*!/*/}
            {/*<p style={{textAlign:'center',overflow:'hidden'}}><strong>{org}</strong></p>*/}
          {/*</div>*/}
          {/*<div className={style.right}>*/}
            {/*<p>总分</p>*/}
            {/*<p>{point5}分</p>*/}
          {/*</div>*/}
          <div className={style.personList}>
            <div className={style.rankIcon}>
              {
                rank == 1 && <div className={style.iconOrg}><Icon type={require("../../../svgs/points/first.svg")} /></div>
              }
              {
                rank == 2 && <div className={style.iconOrg}><Icon type={require("../../../svgs/points/second.svg")} /></div>
              }
              {
                rank == 3 && <div className={style.iconOrg}><Icon type={require("../../../svgs/points/third.svg")} /></div>
              }
              {
                rank != 1 && rank != 2 && rank !=3 && <div className={style.noIconOrg}>{rank}</div>
              }
            </div>
            {/*<div className={style.nolistRanking}>398</div>*/}
            <div className={style.listPeople}>
              {/*<span>{org.length > 13 ? `${org.substring(0, 13)}...` : org}</span>*/}
              <span>{org}</span>
            </div>
            <WhiteSpace size='sm'/>
            <div className={style.listPointsOrg}>{point5}分</div>
          </div>
        </div>
      </div>
    )
  }
}

export default connect()(RankListIteam);
